#!/usr/bin/env pytho
# -*- coding: utf-8 -*-
import requests
import json
url = "http://172.16.1.188:8080/api/manage_member/user/auth/login" # 接口地址

payload = {'password': '123456789','username': 'admin','uuid': '','verifyCode': '',}
r = requests.post(url, json=payload, verify=False)
token = json.loads(r.text)["token"] #获取登录后的token
print(token)

urlcy ='http://172.16.1.21/xl-dcs/api/manage/web_manage/memberprice'

data ={
    "penaltyMeasure": "",
	"type": "1",
	"penaltyTimeWay": "1",
	"defpenaltyDay": "10",
	"penaltyTimeaddDay": "10",
	"maxPenaltyTimeDay": "100",
	"fieldId": [],
	"isDelete": "false",
	"year": "2",
	"month":"3" ,
	"day": "10",
	"priceName": "套餐名称子账号上限2子公司上限2开启提权有查询6年",
	"subAccountNum": "22222222222",
	"subCompanyNum": "22222222222",
	"contractCost": "5000000.55",
	"annualFee": "6000.00",
	"timeLong": "6",
	"remark": "套餐名称备注子账号上限2子公司上限2开启提权有查询6年套餐名称备注子账号上限2子公司上限2开启提权有查询6年",
	"isOpenPrivilege": "true"
}

data1=json.dumps(data)
headers = {"Accept"	:"application/json, text/plain, */*",
"Accept-Encoding"	:"gzip, deflate",
"Accept-Language"	:"zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2",
"Authorization"	: token,
"Connection"	:"keep-alive",
"Content-Length"	:"561",
"Content-Type"	:"application/json",
"Host"	:"172.16.1.21",
"Referer"	:"http://172.16.1.21/loginTo/adminiStration/adminiStration",
"User-Agent"	:"Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.90 Safari/537.36"}

r2 = requests.post(url=urlcy, data=data1, headers=headers)
print(r2.status_code)
print(r2.text)
print(data1)